package me.next.slidebottomviewdemo; import android.annotation.SuppressLint; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.webkit.WebChromeClient; import android.webkit.WebView; import android.widget.EditText; import android.widget.TextView; import me.next.slidebottompanel.SlideBottomPanel; public class MainActivity extends AppCompatActivity { private String webUrl = "http://www.zhihu.com/question/29416073/answer/44340933"; private WebView webView; private TextView tvEdit; private SlideBottomPanel sbv; @SuppressLint("SetJavaScriptEnabled") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); sbv = (SlideBottomPanel) findViewById(R.id.sbv); tvEdit = (TextView) findViewById(R.id.tv_edit); webView = (WebView) findViewById(R.id.wv_main); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl(webUrl); webView.setWebChromeClient(new WebChromeClient()); tvEdit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(MainActivity.this, InputActivity.class); startActivity(intent); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { return super.onOptionsItemSelected(item); } @Override public void onBackPressed() { if (sbv.isPanelShowing()) { sbv.hide(); return; } super.onBackPressed(); } }